<template>
  <div class="containers">
    <logins v-if="key == 3" />
    <logines v-if="key == 1" />
    <loginex v-if="key == 2" />
  </div>
</template>
<script lang="ts" setup>
  import logins from './indexs.vue'
  import logines from './indexes.vue'
  import loginex from './indexe.vue'
  import { ref } from 'vue'
  import { systemAdmin } from '@/api/url'
  import { onMounted } from 'vue'
  import { get } from '@/api/http'
  const key: any = ref('')
  //获取
  const systemAdminFn = () => {
    get({
      url: systemAdmin,
    }).then((res) => {
      key.value = ''

      if (res.data) {
        if (res.data.name) {
          document.title = res.data.name
        }
        if (res.data.logoImage) {
          document.querySelector('link[rel="icon"]')?.setAttribute('href', res.data.logoImage)
        }
        if (res.data.pageStyle == 0) {
          key.value = 3
        } else if (res.data.pageStyle == 1 || res.data.pageStyle == 2) {
          key.value = res.data.pageStyle
        } else {
          key.value = 3
        }
      } else {
        key.value = 3
      }
    })
  }
  onMounted(async () => {
    await systemAdminFn()
  })
</script>

<style lang="less" scoped></style>
